aa6b49de44dbaee727bf98bae03c37bc7543d9f7,distribution/sdk/sample-nsili-client/src/main/java/org/codice/alliance/nsili/client/NsiliClient.java,NsiliClient,testStandingQueryMgr,#ORB#POA#Query#,427
Before Change
public void testStandingQueryMgr(ORB orb, POA poa, Query query) throws Exception {
if (standingQueryMgr != null) {
System.out.println("----------------------");
System.out.println("Standing Query Manager Test");
if (standingQueryMgr != null) {
Event[] events = standingQueryMgr.get_event_descriptions();
if (events != null) {
for (Event event : events) {
NamedEventType namedEventType = event.event_type;
System.out.println("Event: " + event.event_type.value() + " name: " + event.event_name
+ " desc: " + event.event_description);
}
}
}
LifeEvent start = new LifeEvent();
java.util.Date startDate = new java.util.Date();
start.at(ResultDAGConverter.getAbsTime(startDate));
LifeEvent end = new LifeEvent();
long endTime = System.currentTimeMillis() + ONE_YEAR;
java.util.Date endDate = new java.util.Date();
endDate.setTime(endTime);
end.at(ResultDAGConverter.getAbsTime(endDate));
LifeEvent[] frequency = new LifeEvent[1];
LifeEvent freqOne = new LifeEvent();
Time time = new Time((short) 0, (short) 0, 30.0f);
freqOne.rt(time);
frequency[0] = freqOne;
QueryLifeSpan queryLifeSpan = new QueryLifeSpan(start, end, frequency);
NameValue[] props = new NameValue[0];
String callbackId = UUID.randomUUID()
.toString();
try {
standingQueryRequest = standingQueryMgr.submit_standing_query(query,
getResultAttributes(),
getSortableAttributes(),
queryLifeSpan,
props);
standingQueryRequest.set_user_info("Alliance");
standingQueryRequest.set_number_of_hits(200);
TestNsiliStandingQueryCallback nsiliCallback = new TestNsiliStandingQueryCallback(
standingQueryRequest);
try {
poa.activate_object_with_id(callbackId.getBytes(Charset.forName(ENCODING)),
nsiliCallback);
} catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
System.err.println("order : Unable to activate callback object, already active.");
}
org.omg.CORBA.Object obj = poa.create_reference_with_id(callbackId.getBytes(Charset.forName(ENCODING)),
CallbackHelper.id());
Callback callback = CallbackHelper.narrow(obj);
String standingQueryCallbackId = standingQueryRequest.register_callback(callback);
nsiliCallback.setCallbackID(standingQueryCallbackId);
standingQueryCallbacks.add(nsiliCallback);
System.out.println("Registered NSILI Callback: " + standingQueryCallbackId);
} catch (Exception e) {
System.err.println("Error submitting standing query: " + NsilCorbaExceptionUtil.getExceptionDetails(e));
e.printStackTrace(System.err);
throw (e);
}
System.out.println("Standing Query Submitted");
}
}
After Change
nsiliCallback);
} catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
LOGGER.error("Order : Unable to activate callback object, already active : {}",
NsilCorbaExceptionUtil.getExceptionDetails(e),
e);
}